/*
 * subSystemManager.h
 *
 *  Created on: 2011/06/09
 *      Author: AKS
 */

#ifndef SUBSYSTEMMANAGER_H_
#define SUBSYSTEMMANAGER_H_

#include "core/include/aks_processor.h"
#include "core/include/process.h"
#include "core/include/types.h"

#include "core/include/list.h"

/* sub system base address */
#define SS_BASE_ADDRESS 0x50

/* Sub System table definition */
#define HEADER_LEN      0
#define MAGIC_NUMBER    1
#define REVISION        2
#define SYSTEM_TYPE     3
#define SLAVE_ADDRESS   4


#define SYS_TYPE_CAMERA_BUFFER  1
#define SYS_TYPE_LCD_BUFFER     2
#define SYS_TYPE_USB_HOST       3
#define SYS_TYPE_SRAM           4
#define SYS_TYPE_ETHERNET       5
#define SYS_TYPE_GENERAL        6


typedef struct t_MESSAGE_ITM
{
    WORD senderID;
    WORD receiverID;
    void *load;
}MESSAGE_ITM;

typedef struct t_SUB_SYSTEM
{
	BOOL installed;
    BYTE type;
    BYTE revision;
}SUB_SYSTEM;

BOOL SS_enumerate(void);
void SS_showDeviceTable(void);
BOOL SS_updateDeviceInformation(BYTE tgt, BYTE *info, BYTE len, WORD offset);
BOOL SS_activateTask(void);

BOOL SS_sendMessage(WORD senderID, WORD receiverID, WORD messageID, LIST_ITEM *env, MESSAGE_ITM *msg);
BYTE SS_checkMessage(WORD receiverID);
LIST_ITEM *SS_getMessage(WORD receiverID);
LIST_ITEM *SS_getFilteredMessage(WORD senderID, WORD receiverID);

#endif /* SUBSYSTEMMANAGER_H_ */
